POV-Ray : Newsgroups : povray.advanced-users : Random rotation don't work ? : Re: Random rotation don't work ? Server Time
29 Jul 2024 14:18:40 EDT (-0400)
  Re: Random rotation don't work ?  
From: Warp
Date: 7 Mar 2002 11:52:08
Message: <3c879ab8@news.povray.org>
Christopher James Huff <chr### [at] maccom> wrote:
>> > // rotate <360*rand(R1), 360*rand(R1), 360*rand(R1)>

> Or even better:
> rotate 360*< rand(R1), rand(R1), rand(R1)>

  Note that this does not achieve *any* possible orientation the object can
have. For example, I think that it can never reach an orientation like
caused by
  rotate y*30 rotate x*30

  In order to really achieve almost any possible orientation, that random
rotation should be applied several times. Perhaps even a random number of
times. For example:

#declare RotTimes = 5+5*rand(R1); // from 5 to 10 times.
#declare Ind = 0;
#while(Ind < RotTimes)
  rotate 360*<rand(R1),rand(R1),rand(R1)>
  #declare Ind = Ind+1;
#end

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.